/*
 * Test.java - Copyright Apr 27, 2012 Z Networks Group, Inc. All rights reserved.
 * Z Networks Group PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.andromeda.skadi.sandbox2;

import com.andromeda.skadi.Application;
import com.andromeda.skadi.service.ConversionService;
import com.andromeda.skadi.service.conversion.DefaultConversionService;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JPanel;
import org.jdesktop.swingx.JXFrame;

/**
 *
 * @author Dickinson Roman Arismendy Torres
 */
public class Test {
    
    public static void main(String[] args) {
        JXFrame frame = new JXFrame(":)", true);
        JPanel panel = new JPanel(new FormLayout("fill:pref, 2dlu:grow, fill:pref", "pref, 3dlu, pref"));
        CellConstraints cc = new CellConstraints();
        Application.instance().registerService(ConversionService.class, new DefaultConversionService());
        final SwingDataEditor<String> editor = new SwingDataEditor<String>();
        //editor.setData(new EntityAttributeImpl(String.class, "Hola"));
        panel.add(editor, cc.rcw(1, 1, 3));
        panel.add(new JButton(new AbstractAction("Undo") {

            @Override
            public void actionPerformed(ActionEvent e) {
                editor.undo();
            }
        }), cc.rc(3, 1));
        panel.add(new JButton(new AbstractAction("Redo") {

            @Override
            public void actionPerformed(ActionEvent e) {
                editor.redo();
            }
        }), cc.rc(3, 3));
        frame.setContentPane(panel);
        frame.setSize(300, 100);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
    
  
}
